<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>密码修改</title>
    <#include "/common/link.ftl">

</head>
<body class="hold-transition skin-black sidebar-mini">
<div class="wrapper">
    <#include "/common/navbar.ftl">
    <!--菜单回显-->
    <#assign currentMenu="role"/>
    <#include "/common/menu.ftl">
    <div class="content-wrapper">
        <section class="content-header">
            <h1>密码修改</h1>
        </section>
        <section class="content">
            <div class="box">
                <form class="form-horizontal" action="/alterPassword" method="post" id="editForm">
                    <input type="hidden"  name="id" value='${USER_IN_SESSION.id}'>
                    <div class="form-group"  style="margin-top: 10px;">
                        <label  class="col-sm-2 control-label">原密码：</label>
                        <div class="col-sm-6">
                            <input type="text" class="form-control"  name="oldPassword"   placeholder="请输入旧密码">
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-2 control-label">新密码：</label>
                        <div class="col-sm-6">
                            <input type="text" class="form-control"  name="newPassword"  placeholder="请输入新密码">
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-sm-offset-1 col-sm-6">
                            <button type="button" class="btn btn-primary btn-submit" id="submit">确认修改</button>
                            <a href="javascript:window.history.back()" class="btn btn-danger">取消</a>
                        </div>
                    </div>
                </form>
            </div>
        </section>
    </div>
    <#include "/common/footer.ftl">
</div>
<script>
    $('#submit').click(function () {
        var loginParameter = $('#editForm').serialize();
        debugger
        $.post('/alterPassword',loginParameter,function (data) {
            if (data.success){ //true
                Swal.fire({
                    title: '修改成功',
                    icon: 'success'

                }).then(() => {

                })
            }else {
                Swal.fire(
                    '修改失败',
                    data.msg,
                    'error'
                )
            }
        });
    });
</script>

</body>
</html>
